package cn.crm.framework.config;



import cn.crm.system.domain.pojo.entity.MinioPojo;

import io.minio.MinioClient;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;


@Configuration
public class MinioConfig {
    @Autowired
    private MinioPojo minioPojo;

    /**
     * 注入minio 客户端
     * @return
     */
    @Bean
    public MinioClient minioClient() {
            return  MinioClient.builder()
                    .endpoint(minioPojo.getUrl())
                    .credentials(minioPojo.getUsername(), minioPojo.getPassword())
                    .build();

    }

}
